import axios from 'axios';
const request = axios.create();
import { message } from 'antd';
request.interceptors.request.use(
  function (config) {
    return config;
  },
  function (error) {
    return Promise.reject(error);
  }
);
// 添加响应拦截器
request.interceptors.response.use(
  (response) => {
    return response;
  },
  (response) => {
    switch (response.status) {
      case 500:
        message.error('服务器异常');
        break;
      default:
        message.error('未知错误');
        break;
    }
    return Promise.reject(error);
  }
);
export default request;
